﻿<%@ Page Language="C#" AutoEventWireup="true" MasterPageFile="~/admin.master" CodeBehind="Organizations.aspx.cs"
    Inherits="LiveWebServiceAdmin.Organizations" %>

<asp:Content ContentPlaceHolderID="MenuContent" ID="PageType" runat="server">
    <p>
        1</p>
</asp:Content>
<asp:Content ContentPlaceHolderID="TopContent" ID="PageInfo" runat="server">
    Welcome!
    <br />
    <br />
    Your Organizations:
</asp:Content>
<asp:Content ContentPlaceHolderID="TopBannerContent" ID="PageAbout" runat="server">
    About Live@EDU MWS
</asp:Content>
<asp:Content ContentPlaceHolderID="BottomBannerContent" ID="Content1" runat="server">
    You can manage your Live@edu organizations here.
    <br />
    Fore every organization you need to:
    <br />
    1. Create SiteIDs
    <br />
    2. Setup administrator identities
    <br />
    3. Add domains
    <br />
    <br />
    Web-Service SDK is located <a id="sdklink" runat="server" href="javascript:void(0)">
        here</a>.
</asp:Content>
<asp:Content ContentPlaceHolderID="BottomContent" ID="PageMain" runat="server">
    <div id="manageduser">
        <asp:HiddenField ID="hdManagedUser" runat="server" />
    </div>
    <table id="usertable" width="100%">
        <tr align="center">
            <td colspan="4">
                <asp:ListBox ID="lbUserOrganizations" runat="server" Height="250px" Width="100%"
                    SelectionMode="Single"></asp:ListBox>
                <asp:Label ID="lbError" runat="server" Text="" Visible="false"></asp:Label>
            </td>
        </tr>
        <tr align="center">
            <td>
                <a id="neworg" href="javascript:void(0)" title="Create new User Organization" class="thickbox">
                    Add Organization</a>
            </td>
            <td>
                <div id="vieworg">
                    <a href="javascript:void(0)">View Sites</a>
                </div>
            </td>
            <td>
                <div id="editorg">
                    <a href="javascript:void(0)" title="Edit Organization" class="thickbox">Edit Organization</a>
                </div>
            </td>
            <td>
                <div id="deleteorg">
                    <%--<a href="javascript:void(0)" title="Delete Organization" class="thickbox">Delete Organization</a>--%>
                    <asp:Button ID="btnDeleteOrg" CssClass="buttonlink" runat="server" Text="Delete Organization"
                        OnClick="btnDeleteOrg_Click" />
                </div>
            </td>
        </tr>
    </table>
    <div>

        <script language="javascript" type="text/javascript">
            $(document).ready(function() {
                var manageuser = $("#manageduser").find("input").get(0).value;
                $("#neworg").attr("href", "/ActionPages/manageorganizations.aspx?manageuser=" + manageuser + "&keepThis=true&TB_iframe=true&height=155&width=320");

                $("#vieworg").hide();
                $("#vieworg").find("a").attr("href", "javascript:void(0)");

                $("#editorg").hide();
                $("#editorg").find("a").attr("href", "javascript:void(0)");

                $("#deleteorg").hide();
                $("#deleteorg").find("a").attr("href", "javascript:void(0)");
            });

            $("#usertable").find("select").click(function(event) {
                var options = $("#usertable").find("option").each(function(index) {
                    if ($(this).attr("selected")) {
                        var manageuser = $("#manageduser").find("input").get(0).value;
                        var organization = $(this).text();

                        $("#vieworg").show();
                        $("#vieworg").find("a").attr("href", "/siteids.aspx?manageuser=" + manageuser + "&manageorganization=" + organization);

                        $("#editorg").show();
                        $("#editorg").find("a").attr("href", "/ActionPages/manageorganizations.aspx?manageuser=" + manageuser + "&editorganization=" + organization + "&keepThis=true&TB_iframe=true&height=145&width=320");

                        $("#deleteorg").show();
                        //                        $("#deleteorg").find("a").attr("href", "/ActionPages/manageorganizations.aspx?manageuser=" + manageuser + "&deleteorganization=" + organization + "&keepThis=true&TB_iframe=true&height=75&width=320");
                    }
                }
                );
            });
        </script>

    </div>
</asp:Content>
